package com.ithinks.flow.common.utils.protocol.modbus.modbus4J;


import com.serotonin.modbus4j.ModbusFactory;
import java.util.Objects;

/**
 * @Description
 * @ClassName ModbusFactoryInstance
 * @Author MR.LI
 * @date 2020.12.06 21:54
 */
public final class ModbusFactoryInstance {

    private volatile  static ModbusFactory modbusFactory;

    private ModbusFactoryInstance(){}

    public static ModbusFactory getInstance(){
        if(Objects.isNull(modbusFactory)){
            synchronized (ModbusFactoryInstance.class){
               if(Objects.isNull(modbusFactory)) {
                   modbusFactory = new ModbusFactory();
               }
            }
        }
        return modbusFactory;
    }
}
